<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>四则运算</title>
    <script language="JavaScript">
        function equal(e){
            a = myform.a.value;
            b = myform.b.value;
            switch(e){
                case"+":jieguo = (a*1)+(b*1);
                break;
                case"-":jieguo = a-b;
                break;
                case"*":jieguo=a*b;
                break;
                case"/":jieguo=a/b;
                break;
                case"": a = "";
                b = "";
                jieguo = "";
                break;
            }
           
               
            
            myform.jieguo.value=jieguo;
        }
    </script>
</head>
<body>
    <form   name="myform">
            <h3>四则运算</h3>
    数值<input type="text" name="a" size="5" placeholder="请输入第一个数"><br>
    数值<input type="text" name="b" size="5" placeholder="请输入第二个数"><br>
    结果<input type="text" name="jieguo" size="5" placeholder="结果"><br>
    <input type="button" value="加" onclick="equal('+')">
    <input type="button" value="减" onclick="equal('-')">
    <input type="button" value="乘" onclick="equal('*')">
    <input type="button" value="除" onclick="equal('/')">
    <input type="button" value="重置" onclick="equal('')">
    </form>
</body>
</html>